<?php
class Authorizer
{
    public function __construct()
    {
    }
    
    public function userLogin( $login )
    {
        session_name( 'My site session' );
        $_SESSION['authorized'] = 1;
        $_SESSION['login'] = $login;
        header( "Location: /php/search.php" );
    }

    public function userLogout()
    {
        $_SESSION = array();
        session_destroy();
        header( "Location: /php/login.php" );
    }

    static function isUserLoggedIn()
    {
        if ( !isset( $_SESSION['authorized'] ) )
        {
            header( "Location: /php/login.php?auth=not_logged_in" );
            exit;
        }
    }
}
?>